package com.tool.btn;

import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;
import org.come.Frame.ZhuFrame;
import org.come.Jpanel.*;

import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.CutButtonImage;
import org.come.until.FormsManagement;
import org.come.until.GsonUtil;

import javax.swing.*;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;

public class GetLiangHaoBtn extends MoBanBtn {

	/** 1:购买点卡、2：寄售点卡、3：抽奖 */
	private int caozuo;
	private GetLiangHaoTabJpanel cardJpanel;
	private GetLiangHaoJpanel getLiangHaoJpanel;
	private GetLiangHaoOneJpanel getLiangHaoOneJpanel;
	private GetLiangHaoTwoJpanel getLiangHaoTwoJpanel;
	private GetLiangHaoThreeJpanel getLiangHaoThreeJpanel;

	public GetLiangHaoBtn(String iconpath, int type, int caozuo, GetLiangHaoTabJpanel cardJpanel,
						  GetLiangHaoJpanel getLiangHaoJpanel) {
		super(iconpath, type);
		// TODO Auto-generated constructor stub
		this.caozuo = caozuo;
		this.cardJpanel = cardJpanel;
		this.getLiangHaoJpanel = getLiangHaoJpanel;
	}

	public GetLiangHaoBtn(String iconpath, int type, String text, int caozuo, GetLiangHaoOneJpanel getLiangHaoOneJpanel) {
		super(iconpath, type);
		// TODO Auto-generated constructor stub
		this.caozuo = caozuo;
		this.getLiangHaoOneJpanel = getLiangHaoOneJpanel;
		setText(text);
		setFont(UIUtils.TEXT_HY16);
		setVerticalTextPosition(SwingConstants.CENTER);
		setHorizontalTextPosition(SwingConstants.CENTER);

	}
	public GetLiangHaoBtn(String iconpath, int type, String text, int caozuo, GetLiangHaoTwoJpanel getLiangHaoTwoJpanel) {
		super(iconpath, type);
		// TODO Auto-generated constructor stub
		this.caozuo = caozuo;
		this.getLiangHaoTwoJpanel = getLiangHaoTwoJpanel;
		setText(text);
		if (caozuo == 11) {
			setFont(UIUtils.TEXT_HY16);
		} else {
			setFont(UIUtils.TEXT_FONT11);
			setColors(UIUtils.COLOR_BTNTEXT);
		}
		setVerticalTextPosition(SwingConstants.CENTER);
		setHorizontalTextPosition(SwingConstants.CENTER);
	}

	public GetLiangHaoBtn(String iconpath, int type, String text, int caozuo, GetLiangHaoThreeJpanel getLiangHaoThreeJpanel) {
		super(iconpath, type);
		// TODO Auto-generated constructor stub
		this.caozuo = caozuo;
		this.getLiangHaoThreeJpanel = getLiangHaoThreeJpanel;
		setText(text);
		if (caozuo == 11) {
			setFont(UIUtils.TEXT_HY16);
		} else {
			setFont(UIUtils.TEXT_FONT11);
			setColors(UIUtils.COLOR_BTNTEXT);
		}
		setVerticalTextPosition(SwingConstants.CENTER);
		setHorizontalTextPosition(SwingConstants.CENTER);
	}
	@Override
	public void chooseyes() {
	}
	@Override
	public void chooseno() {
	}
	@Override
	public void nochoose(MouseEvent e) {
		try {
			switch (caozuo) {
			case 2:			//选靓号
				if (MyIsif.getStyle().equals("水墨UI")) {
					getLiangHaoJpanel.getBtnChoose().setIcons(CutButtonImage.cuts("inkImg/newbutton/xuan.png"));
					getLiangHaoJpanel.getBtnRob().setIcons(CutButtonImage.cuts("inkImg/newbutton/qiangxiao.png"));
					getLiangHaoJpanel.getBtnLetter().setIcons(CutButtonImage.cuts("inkImg/newbutton/xinjianxiao.png"));

				} else {
					getLiangHaoJpanel.getBtnChoose().setIcons(CutButtonImage.cuts("inkImg/newbutton/xuan.png"));
					getLiangHaoJpanel.getBtnRob().setIcons(CutButtonImage.cuts("inkImg/newbutton/qiangxiao.png"));
					getLiangHaoJpanel.getBtnLetter().setIcons(CutButtonImage.cuts("inkImg/newbutton/xinjianxiao.png"));
				}
				cardJpanel.getGetLiangHaoOneJpanel().changeFrom(caozuo);
				cardJpanel.getCar().show(cardJpanel, "2");

				//getLiangHaoJpanel.getGetliangHaoTabJpanel().getGetLiangHaoOneJpanel()

				String mes2 = Agreement.getAgreement().selllianghaoAgreement("SELLLIST");
				SendMessageUntil.toServer(mes2);
				break;
			case 3:
				if (MyIsif.getStyle().equals("水墨UI")) {
					getLiangHaoJpanel.getBtnChoose().setIcons(CutButtonImage.cuts("inkImg/newbutton/xuanxiao.png"));
					getLiangHaoJpanel.getBtnRob().setIcons(CutButtonImage.cuts("inkImg/newbutton/qiang.png"));
					getLiangHaoJpanel.getBtnLetter().setIcons(CutButtonImage.cuts("inkImg/newbutton/xinjianxiao.png"));
				} else {
					getLiangHaoJpanel.getBtnChoose().setIcons(CutButtonImage.cuts("inkImg/newbutton/xuanxiao.png"));
					getLiangHaoJpanel.getBtnRob().setIcons(CutButtonImage.cuts("inkImg/newbutton/qiang.png"));
					getLiangHaoJpanel.getBtnLetter().setIcons(CutButtonImage.cuts("inkImg/newbutton/xinjianxiao.png"));
				}
				cardJpanel.getGetLiangHaoTwoJpanel().changeFrom(caozuo);
				cardJpanel.getCar().show(cardJpanel, "3");

				String mes3 = Agreement.getAgreement().selllianghaoAgreement("AUCLIST");
				SendMessageUntil.toServer(mes3);

				break;
			case 4:
				if (MyIsif.getStyle().equals("水墨UI")) {
					getLiangHaoJpanel.getBtnChoose().setIcons(CutButtonImage.cuts("inkImg/newbutton/xuanxiao.png"));
					getLiangHaoJpanel.getBtnRob().setIcons(CutButtonImage.cuts("inkImg/newbutton/qiangxiao.png"));
					getLiangHaoJpanel.getBtnLetter().setIcons(CutButtonImage.cuts("inkImg/newbutton/xinjian.png"));
				} else {
					getLiangHaoJpanel.getBtnChoose().setIcons(CutButtonImage.cuts("inkImg/newbutton/xuanxiao.png"));
					getLiangHaoJpanel.getBtnRob().setIcons(CutButtonImage.cuts("inkImg/newbutton/qiangxiao.png"));
					getLiangHaoJpanel.getBtnLetter().setIcons(CutButtonImage.cuts("inkImg/newbutton/xinjian.png"));
				}
				cardJpanel.getGetLiangHaoThreeJpanel().changeFrom(caozuo);
				cardJpanel.getCar().show(cardJpanel, "4");
				break;
			case 10:
				//getLiangHaoJpanel.getGetliangHaoTabJpanel().getGetLiangHaoOneJpanel()
				String searchText = getLiangHaoOneJpanel.getSearchText().getText();
				String mes = Agreement.getAgreement().selllianghaoAgreement("SELLLIST|"+searchText);
				SendMessageUntil.toServer(mes);
				break;
			case 11:
				break;
			case 12:
				break;
			case 50:
				break;
			case 150:
				break;
			case 1000:
				break;
			case 9999:
				break;
			default:
				break;
			}
		} catch (Exception e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}

	}
}
